var net = require('net');

var options = {  
    port : 8000
}

var tcp_client = net.Socket();
tcp_client.connect(options,function(){
    console.log('connected to Server');
    
})

tcp_client.on('data',function(data){
    console.log('received data: %s from server', data.toString());
    setTimeout(() => {
        tcp_client.write('AAAAA');
        tcp_client.write('bbbbb');
    },1000)
})

tcp_client.on('end',function(){
    console.log('data end!');
})

tcp_client.on('error', function () {
    console.log('tcp_client error!');
})